package com.jzl.swing.service.impl;

import java.sql.SQLException;
import java.util.List;

import com.jzl.swing.dao.BillDao;
import com.jzl.swing.dao.impl.BillDaoImpl;
import com.jzl.swing.entity.Bill;
import com.jzl.swing.service.BillService;

public class BillServiceImpl implements BillService{

 	private BillDao billDao = new BillDaoImpl();
	
	@Override
	public boolean insertBill(Bill bill) throws SQLException {
		billDao.add(bill);
		return true;
	}

	@Override
	public boolean modifyBill(Bill bill) throws SQLException {
		billDao.modify(bill);
		return true;
	}

	@Override
	public List<Bill> queryAll() throws SQLException {
		
		return billDao.queryAll();
	}

	@Override
	public List<Bill> queryByNameAndPaid(String name, String isPaid) throws SQLException {
		return billDao.queryByNameAndPaid(name, isPaid);
	}

	@Override
	public Bill queryByNumber(String number) throws SQLException {
		
		return billDao.queryByNumber(number);
	}

	@Override
	public int deleteByNumber(String number) throws SQLException {
		billDao.delete(number);
		return 0;
	}

}
